#!/bin/bash
# testing environment

if [ $# != 3 ] ; then
	echo "usage: ./standard number_of_daemons server_ip server_port"
	exit
fi


MP="`dirname \"$0\"`"  
cd $MP
MP=`pwd`
PD="$MP/packageDirs"
rm -rf "$PD"
mkdir "$PD"
IP="$MP/inputPipes"
rm -rf "$IP"
mkdir "$IP"

./kill

./server $2 $3 | ./prefix server &

sleep 1

for i in `seq 1 $1` ; do
	./daemon "$PD/$i" $2 $3 2>&1 | ./prefix "daemon $i" &
done

sleep 3

./controller "inputPipes"
